package com.mornd.gulimall.cart.config;

import com.mornd.gulimall.cart.interceptor.CartInterceptor;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

import javax.annotation.Resource;

/**
 * @author: mornd
 * @dateTime: 2023/8/20 - 8:10
 */

@Configuration
public class WebMvcConfig implements WebMvcConfigurer {
    @Resource
    private CartInterceptor cartInterceptor;

    /**
     * 注册拦截器
     * @param registry
     */
    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(cartInterceptor).addPathPatterns("/**");
    }
}
